package com.project.voicememoassistant.controller;

import com.project.voicememoassistant.api.CommonResult;
import com.project.voicememoassistant.model.*;
import com.project.voicememoassistant.service.FindService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/find")
public class FindAllController {
    @Resource
    private FindService findService;

    @GetMapping("/allLedgerByUid")
    public CommonResult<Map<String,Object>> FindAllLedger (String uid){
        return CommonResult.success(findService.findAllLeagerByUid(uid));
    }

    @GetMapping("/allMenstruationByUid")
    public CommonResult<List<Menstruation>> FindAllMenstruation (String uid){
        return CommonResult.success(findService.findAllMenstruationByUid(uid));
    }

    @GetMapping("/allPermanentByUid")
    public CommonResult<List<Permanent>> FindAllPermanent (String uid){
        return CommonResult.success(findService.findAllPermanentByUid(uid));
    }

    @GetMapping("/allRemindByUid")
    public CommonResult<List<Remind>> FindAllRemind (String uid){
        return CommonResult.success(findService.findAllRemindByUid(uid));
    }

    @GetMapping("/allRemindDate")
    public CommonResult<List<Remind>> FindAllRemindDate (String uid,String date){
        return CommonResult.success(findService.findAllRemindDate(uid,date));
    }

    @GetMapping("/allScheduleByUid")
    public CommonResult<List<Schedule>> FindAllSchedule (String uid){
        return CommonResult.success(findService.findAllScheduleByUid(uid));
    }

    @GetMapping("/allUser")
    public CommonResult<List<User>> FindAllUser (){
        return CommonResult.success(findService.findAllUser());
    }

    @GetMapping("/allRemindByUidInSomeTime")
    public CommonResult<List<Remind>> FindRemindByUidInSomeTime (String uid){
        return CommonResult.success(findService.findRemindByUidInSomeTimes(uid));
    }

    @GetMapping("/allMenstruationByUidInSomeTime")
    public CommonResult<List<Menstruation>> FindMenstruationByUidSomeTime (String uid){
        return CommonResult.success(findService.findAllMenstruationByUidInSomeTimes(uid));
    }

    @GetMapping("/tip")
    public CommonResult<String> findTip(){
        return CommonResult.success(findService.findATip());
    }

    @GetMapping("/allRemindByType")
    public CommonResult<List<Remind>> FindAllRemind (String uid,int type){
        return CommonResult.success(findService.findRemindByType(uid, type));
    }

    @GetMapping("/allPermanentByType")
    public CommonResult<List<Permanent>> FindAllPermanent (String uid,int type){
        return CommonResult.success(findService.findPermanentByType(uid, type));
    }

    @GetMapping("/accessToken")
    public CommonResult<String> FindToken(){
        return CommonResult.success(findService.findToken());
    }

    @GetMapping("/update")
    public CommonResult<String> Update(){
        findService.updateToken("123456");
        return CommonResult.success("成功");
    }
}
